<?php
include 'conn/conn.php';
if (isset($_POST['submit'])){
	
	$name = $_POST["username"];
	$pass = $_POST["password"];
	
	if (!empty($name) && !empty($pass)){
			$sql = "select * from tb_admin where name='$name' and pwd='$pass'";
			
			if ($rs = mysql_query($sql)){
				echo "<script type=\"text/javascript\">alert('登陆成功！');window.location.href='templets/';</script>";
			}else {
				echo "<script type=\"text/javascript\">alert('用户名，密码错误，登录失败！');</script>";
			}
		}else{
			echo ("<script type=\"text/javascript\">alert ('请正确填写用户名和密码！！');history.back();</script>");
		}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>中科智远--后台管理系统</title>
<link rel="stylesheet" href="../style/style.css" type="text/css" />
<link rel="stylesheet" href="../style/select2css.css" type="text/css" />
</head>

<body>
	<div class="top">
    	<div class="logo"><img src="../images/logo.png" width="294" height="56" alt="中科智远" /></div>
        <div class="top_right">
        	<div class="search">
        		<form action="" method="post">
            		<input type="search" />
            	</form>
            </div>
            <a target="_blank" href="http://sighttp.qq.com/authd?IDKEY=e9a99cb7bc8dd91b4b3c6ee0068ee32e0c585c160706975e"><img src="../images/kf.png" width="75" height="23" alt="在线客服" /></a>
        </div>
    </div>
    <div class="login">
    	<div class="login_top">
        	<h3>管理员登陆</h3>
        </div>
        <div class="login_area">
        	<div class="login_img"><img src="../images/login.jpg" width="938" height="106" alt="登陆" /></div>
            <div class="form">
                <form method="post" action="">
                    <label><span><img src="../images/user.gif" width="55" height="21" /></span><input type="text" name="username" class="" /></label>
                    <label><span><img src="../images/pass.gif" width="55" height="21" /></span><input type="password" name="password" class=""  /></label>
                    <label><input type="submit" name="submit" value="确定" class="text" /><input type="button" value="注册" class="text" /></label>
                </form>
            </div>
        </div>
    	<div class="shadow"><img src="../images/shadow.jpg" width="946" height="22" alt="" /></div>
    </div>
    <?php include_once '../footer.php';?>
</body>
</html>